﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Windows.Controls.Ribbon;
using System.Windows;

namespace OODCRM.ViewModel
{
    public static partial class RibbonModel
    {

        #region ViewModel

        public static ControlData Help
        {
            get
            {
                lock (_lockObject)
                {
                    string Str = "Help";

                    if (!_dataCollection.ContainsKey(Str))
                    {
                        ButtonData Data = new ButtonData()
                        {
                            SmallImage = new Uri("/OODCRM;component/Images/info-16.png", UriKind.Relative),
                            ToolTipTitle = "Trợ giúp (F1)",
                            ToolTipDescription = "Trợ giúp ứng dụng OODCRM"
                        };
                        _dataCollection[Str] = Data;
                    }

                    return _dataCollection[Str];
                }
            }
        }

        private static MainWindow CRMWindow
        {
            get
            {
                if (Application.Current.Properties.Contains("MainWindowRef"))
                {
                    WeakReference crmWindow = Application.Current.Properties["MainWindowRef"] as WeakReference;
                    if (crmWindow != null)
                    {
                        return crmWindow.Target as MainWindow;
                    }
                }
                return null;
            }
        }

        #endregion ViewModel

        internal static void DefaultExecuted()
        {
        }

        internal static bool DefaultCanExecute()
        {
            return true;
        }

        #region Data

        private const string HelpFooterTitle = "Press F1 for more help.";
        private static object _lockObject = new object();
        private static Dictionary<string, ControlData> _dataCollection = new Dictionary<string, ControlData>();

        // Store any data that doesn't inherit from ControlData
        private static Dictionary<string, object> _miscData = new Dictionary<string, object>();

        #endregion Data
    }
}
